Microsoft Orleans for Developers by Richard Astbury

Microsoft Orleans for Developers by Richard Astbury

Author:Richard Astbury
Language: eng
Format: epub
ISBN: 9781484281673
Publisher: Apress


var instruction = this.state.State.Instructions.Dequeue();

var key = this.GetPrimaryKeyString();

this.logger.LogWarning("{Key} returning '{Instruction}'",

this.key, instruction);

await this.Publish(instruction);

await this.state.WriteStateAsync();

return instruction;

}

}

}

The OnActivate method calls the GetStreamProvider method on the grains base class. The name of the stream provider must match that used in the HostBuilder configuration.

We use the stream provider to create the stream we’re going to publish the event on. Streams are identified using a combination of a GUID and a namespace. In this example, we’re using an empty GUID, and using one stream called “StartingInstruction,” to indicate this is a stream for all robots starting an instruction.

Note

Streaming in Orleans is optimized for lots of transient streams. For example, we could have several streams for each grains, and like grains, the streams are virtual and effectively already exist before you write to them or read messages from them.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.